package homework.bank;

public class CreditCard implements BankCard {
    private double balance;
    private double creditLimit;
    String cardNumber;
    String cardCode;
    double Amount;

    public CreditCard() {
        balance = 0;
        creditLimit = 1000; // 信用卡透支额度
    }

    @Override
    public void deposit(String cardNumber,double amount) {
        balance += amount;
    }

    @Override
    public void withdraw(double amount) {
        if (amount <= balance + creditLimit) {
            balance -= amount;
        } else {
            System.out.println("Exceeded credit limit");
        }
    }

    @Override
    public double checkBalance() {
        return balance;
    }
}
